﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameTimeSystem;

namespace SkillSystem
{
    public class SkillTimeProcesser : SkillItemProcesserBase
    {
        public Action<float> OnUpdate;
        public override void Break()
        {

        }

        public override void Do()
        {
            GameTimer timer = GameTimeSystemFacade.Inst.GetGameUpdateTimer(SystemPriority.Skill);
            timer.Register(OnGameUpdate);
            if (OnItemCompleted != null)
            {
                OnItemCompleted();
            }
        }

        public override void OnSkillCompleted()
        {
            
        }

        private void OnGameUpdate(float deltaTime)
        {
            if (OnUpdate!=null)
            {
                OnUpdate(deltaTime);
            }
        }
    }
}
